/*
 * Copyright (C) 2012  Romain DUBOIS
 * 
 * This file is part of NeMoS - Network and Modular Software
 * 
 * NeMoS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * NeMoS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with NeMoS.  If not, see <http://www.gnu.org/licenses/>.
 */
package nemos;

import java.util.Properties;

/**
 * EProperties : The launch properties enumeration.
 * 
 * @author Romain DUBOIS
 */
public enum EProperties {

    /** The bundles dirs property */
    BUNDLES_DIRS("nemos.osgi.bundles.dirs", "lib/bundles"), //$NON-NLS-1$ //$NON-NLS-2$

    /** The locale property */
    LOCALE("nemos.osgi.locale", ""), //$NON-NLS-1$ //$NON-NLS-2$

    /** The settings file property */
    SETTINGS_FILE("nemos.conf.path", "conf/config.properties"); //$NON-NLS-1$ //$NON-NLS-2$

    /** The NeMoS properties root */
    static final String NEMOS_ROOT = "nemos.osgi."; //$NON-NLS-1$

    /** The default value */
    private final String mDefault;
    /** The property key */
    private final String mKey;

    /**
     * Constructor
     * 
     * @param pKey
     *            The property key
     * @param pDefault
     *            The default value
     */
    private EProperties(final String pKey, final String pDefault) {
        mKey = pKey;
        mDefault = pDefault;
    }

    /**
     * @param pProperties
     *            The properties
     * @return The property value
     */
    public String getValue(final Properties pProperties) {
        return pProperties.getProperty(mKey, mDefault);
    }

    /**
     * @return the key
     */
    public String getKey() {
        return mKey;
    }
}
